<template>
  <div>
    <Breadcrumb>
      <BreadcrumbItem>首页</BreadcrumbItem>
      <BreadcrumbItem>API接口配置</BreadcrumbItem>
    </Breadcrumb>
    <Form ref="formInline" :model="request" inline>
      <div class="config" style="margin-bottom: 20px">
        <span>app_id：</span><span>2108171447037810</span>
      </div>
      <div class="config" style="margin-bottom: 20px">
        <span>app_secret：</span><span>d603cb66631a7b802305388266936c8b</span>
      </div>
      <FormItem>
        订单回调地址：<Input type="text"  clearable   style="width: 200px" value="http://deviceapi.ys-n.com/admin/notify/order" />
      </FormItem><br>
      <FormItem>
        消息回调地址: <Input type="text"  clearable   style="width: 200px" value="http://deviceapi.ys-n.com/admin/notify/notify" />
      </FormItem><br>

      <FormItem>
        <Button type="primary" @click="search" style="margin-left: 100px"
        >提交保存</Button
        >
      </FormItem>
    </Form>
    <div>

    </div>
  </div>

</template>

<script>
  export default {
    data() {
      return {
        params: {
          device_time: [],
          status: 1,
          user_id: "",
          order_id: "",
          activity_id: "",
          page: 1,
          limit: 10,
        },
        total: 0,
        page: {},
        height: this.$store.state.height,
        modal1: false,
        modal3: false,
        data1: [
          {
            id: 1,
            title: "机器组3",
          },
          {
            id: 2,
            title: "机器组4",
          },
        ],
        request: {
          device_number: "",
          page: 1,
        },
        columns1: [
          {
            title: "活动ID",
            key: "activity_id",
            minWidth: 150,
            align: "center"
          },
          {
            title: "活动名称",
            key: "activity_name",
            minWidth: 300,
            align: "center"
          },
          {
            title: "活动有效名称",
            key: "useful_name",
            minWidth: 150,
            align: "center"
          },

          {
            title: "活动类型",
            key: "activity_types",
            minWidth: 150,
            align: "center",
          },
          {
            title: "已优惠金额",
            key: "discount_price",
            minWidth: 150,
            align: "center",
          },
          {
            title: "参与该活动订单量",
            key: "activity_counts",
            minWidth: 150,
            align: "center",
          },
          {
            title: "拉新",
            key: "news",
            minWidth: 150,
            align: "center",
          },
          {
            title: "参与活动的用户数",
            key: "user_counts",
            minWidth: 150,
            align: "center",
          },
          {
            title: "操作",
            slot: "option",
            minWidth: 160,
            align: "center",
          }
        ],
        data: [
          {
            user_id: 1,
            order_id:'2019089878',
            device_name:'B8370',
            belong_shop:'B5789',
            order_counts:'111'
          },
          {
            user_id: 1,
            order_id:'001',
            device_name:'B7890',
            belong_shop:'B5790',
            order_counts:'222'

          }

        ],

        columns2: [
          {
            title: "活动ID",
            key: "user_id",
            minWidth: 150,
            align: "center"

          },
          {
            title: "活动名称",
            key: "activity_name",
            minWidth: 300,
            align: "center"
          },
          {
            title: "活动有效名称",
            key: "useful_name",
            minWidth: 150,
            align: "center"
          },

          {
            title: "活动类型",
            key: "activity_types",
            minWidth: 150,
            align: "center",
          },
          {
            title: "已优惠金额",
            key: "discount_price",
            minWidth: 150,
            align: "center",
          },
          {
            title: "参与该活动订单量",
            key: "activity_counts",
            minWidth: 150,
            align: "center",
          },
          {
            title: "拉新",
            key: "news",
            minWidth: 150,
            align: "center",
          },
          {
            title: "参与活动的用户数",
            key: "user_counts",
            minWidth: 150,
            align: "center",
          }
        ],
        data2: [
          {
            user_id: 1,
            order_id:'2019089898',
            device_id:'康师傅冰红茶柠檬味瓶装500mlx1',
            device_name:'B8370',
            device_time:'0.75',
            belong_shop:'2021-09-18 14:38:15',
            order_counts:'123',
            customer_price:'123',
            total_price:'234',
            before_price:'999',
            discount_price:'10000'
          },
          {
            user_id: 2,
            order_id:'2019089898',
            device_id:'康师傅冰红茶柠檬味瓶装500mlx1',
            device_name:'B8370',
            device_time:'0.75',
            belong_shop:'2021-09-18 14:38:15',
            order_counts:'123',
            customer_price:'123',
            total_price:'234',
            before_price:'999',
            discount_price:'10000'
          },
          {
            user_id: 3,
            order_id:'2019089898',
            device_id:'康师傅冰红茶柠檬味瓶装500mlx1',
            device_name:'B8370',
            device_time:'0.75',
            belong_shop:'ijooz',
            order_counts:'123',
            customer_price:'123',
            total_price:'234',
            before_price:'999',
            discount_price:'10000'
          }
        ],
        role_id:null,
      };
    },
    mounted() {

      this.init();
    },
    methods: {
      add3(){
        this.cancel();
        this.modal3 = true
        this.allocated = [];
        this.undistributed = [];
        if(this.infoID == 6){
          console.log('6')
          this.axios.post("device/getAllDev").then(res => {
            if (res.code == 1) {
              this.allocated = res.data.allocated;
              this.undistributed= res.data.undistributed;
            }
          });

        }
      },
      init() {
        this.axios.post("order/order_list", this.params).then((res) => {
          console.log("this.params: ", this.params);
          if (res.code == 1) {
            console.log(res);
            this.total = res.data.count;
            this.tableData = res.data.list;
          }
        });
      },
      search() {
        this.params.page = 1;
        this.init();
      },
      confirm() {
        this.modal1 = false;
        this.$Message.success("保存成功！");
        this.cancel();
      },
      cancel() {},
      add() {
        this.modal1 = true;
      },
      setStatus(id, status) {
        var text = "确定要" + (status == 1 ? "启用" : "禁用") + "此机器组么？";
        this.$Modal.confirm({
          title: text,
          onOk: () => {
            this.$Message.success("操作成功");
          },
          onCancel: () => {},
        });
      },
      lists() {},
      timechange(val) {
        console.log(val);
      },
      handleSizeChange(val) {
        this.request.page = 1;
        this.request.limit = val;
        this.lists();
      },
      handleCurrentChange(val) {
        this.params.page = val;
        this.init();
      },
    },
  };
</script>

<style>
  *{
    margin: 0;
    padding: 0;
  }
  .door_device{
    position: relative;
    top: -20px;
  }
  .words{
    color: rgb(250, 100, 20);
    font-weight: bold;
    font-size: 20px;
  }
</style>
